﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        //1.定义一个用户类，存放用户的账号、用户名和密码属性；

        //2.在用户类中定义一个方法输出当前用户对象的账号、用户名和密码的信息；然后在主方法调用输出；

        static void Main(string[] args)
        {
            Class1 s = new Class1();
            s.account = 123;
            s.user = 321;
            s.password = 312;
            s.zh();
            Console.ReadKey();
        }
        static void lx()
        {
            Console.WriteLine("输入一个奇数：");
            int s = int.Parse(Console.ReadLine());

            for (int i = 0; i < s; i++)
            {
                for (int j = 0; j < s - i; j++)
                {
                    Console.Write(" ");
                }
                for (int k = 0; k < i * 2 - 1; k++)
                {
                    Console.Write("*");
                }

                Console.WriteLine("");
            }
            for (int u = 2; u <= s - 1; u++)
            {
                for (int b = 0; b < u; b++)
                {
                    Console.Write(" ");
                }
                for (int o = (s - 1) * 2 - 1; o >= u * 2 - 1; o--)
                {
                    Console.Write("*");
                }
                Console.WriteLine("");
            }
            Console.ReadKey();
        }
        static void yhsj()
        {
            int[][] ss = new int[10][];
            for (int i = 0; i < ss.GetLength(0); i++)
            {
                ss[i] = new int[i + 1];
            }
            for (int i = 0; i < ss.GetLength(0); i++)
            {
                ss[i][0] = 1;
                ss[i][i] = 1;

                for (int k = 1; k < ss[i].Length - 1; k++)
                {
                    ss[i][k] = ss[i - 1][k - 1] + ss[i - 1][k];
                }
            }

            for (int i = 0; i < ss.GetLength(0); i++)
            {
                for (int j = 0; j < ss[i].Length; j++)
                {
                    Console.Write("{0} ", ss[i][j]);
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
        static void sz()
        {
            //在 Main 方法中创建一个字符串类型的数组，并存入 5 个值，然后将数组中下标是偶数的元素输出。
            String[] ss = new String[5];

            for (int i = 0; i < ss.Length; i++)
            {
                Console.WriteLine("输入第{0}个字符串：", i + 1);
                String s = Console.ReadLine();
                ss[i] = s;
            }
            Console.WriteLine("数组为：");
            for (int i = 0; i < ss.Length; i++)
            {
                Console.Write(ss[i] + " ");
            }
            Console.WriteLine();
            Console.WriteLine("下标是偶数的元素为：");
            for (int i = 0; i < ss.Length; i++)
            {
                if (i % 2 == 0)
                {
                    Console.WriteLine(ss[i]);
                }
            }
            Console.ReadKey();
        }
        static void zfx()
        {
            //用户输入正方形边长，用* 打印出实心正方形。

            //如：用户输入5，则输出如下图形。
            //*****
            //*****
            //*****
            //*****
            //*****
            Console.WriteLine("请输入正方形的边长：");
            int s = int.Parse(Console.ReadLine());
            String[,] ss = new String[s, s];
            for (int i = 0; i < ss.GetLength(0); i++)
            {
                for (int j = 0; j < ss.GetLength(1); j++)
                {
                    ss[i, j] ="*";
                } 
            }
            for (int i = 0; i < ss.GetLength(0); i++)
            {
                for (int j = 0; j < ss.GetLength(1); j++)
                {
                    Console.Write(ss[i,j]);
                }
                Console.WriteLine("");
            }
            Console.ReadKey();
        }
        static void cfb()
        {
            String[,] ss = new String[9,9];
            for (int i = 0; i < ss.GetLength(0); i++)
            {
                for (int j = 0; j < ss.GetLength(1); j++)
                {
                    ss[i, j] = (i+1) + "*" + (j+1) + "=" + (i + 1) * (j + 1);
                }
            }
            for (int i = 0; i < ss.GetLength(0); i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    Console.Write(ss[i, j]);
                }
                Console.WriteLine("");
            }
            Console.ReadKey();
        }
        static void kxzfx()
        {
            Console.WriteLine("请输入正方形的边长：");
            int a = int.Parse(Console.ReadLine());
            string xx = "*";
            string kg = " ";
            var ss = new int[a, a];
            for (int x = 0; x < a; x++)
            {
                ss[x, 0] = 1;
                ss[x, a - 1] = 1;
            }
            for (int y = 0; y < a; y++)
            {
                ss[0, y] = 1;
                ss[a - 1, y] = 1;
            }
            for (int y = 0; y < a; y++)
            {
                for (int x = 0; x < a; x++)
                {
                    if (ss[x, y] > 0) 
                    {
                        Console.Write(xx); 
                    }
                    else 
                    { 
                        Console.Write(kg); 
                    }
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }

    }
}
